package com.pay.ioopos.support.serialport.custom;

/**
 * 外部串口设备支付通讯工厂类
 * @author moyq5
 * @since 2022/7/28
 */
public final class SerialPortPayFactory {
    private final static SerialPortPayer payer = new SerialPortPayerDefault();
    public static SerialPortPayer getPayer() {
        return payer;
    }

    public static void detect() {
        CustomSerialPortFactory.find(new SerialPortPayFinder() {
            @Override
            public void onFound(CustomSerialPort serialPort) {
                serialPort.setListener(SerialPortPayListener.getInstance());
                serialPort.send(new SerialPortPayCmd2Version());
            }
        });
    }
}
